/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lucava.metamodel.uspeed;

import java.util.ArrayList;
import java.util.Iterator;
import lucava.metamodel.uspeed.visitor.IElementVisitor;

/**
 *
 * @author glenn
 */
public class MethodElement extends TypedElement {

    /**
     * Liste des parametres de la méthode.
     */
    protected ArrayList<ParameterElement> parameters = new ArrayList<ParameterElement>();

    public ArrayList<ParameterElement> getParameters() {
        return parameters;
    }

    public void setParameters(ArrayList<ParameterElement> parameters) {
        this.parameters = parameters;
    }

    public void addParameter(ParameterElement param) {
        this.parameters.add(param);
    }

    @Override
    public void accept(IElementVisitor visitor) {
        visitor.enterMethod(this);
        Iterator<ParameterElement> paramIt = parameters.iterator();
        while (paramIt.hasNext()) {
            paramIt.next().accept(visitor);
        }
        visitor.leaveMethod(this);
    }
}
